<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" +
            request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
    <link rel="shortcut icon" href="<%=basePath%>static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="<%=basePath%>static/css/font.css">
    <link rel="stylesheet" href="<%=basePath%>static/css/xadmin.css">

    <%--<script src="${pageContext.request.contextPath}/static/js/jquery.js"></script>
        <script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>--%>
    <script src="<%=basePath%>static/js/jquery.js"></script>
    <script src="<%=basePath%>static/js/pintuer.js"></script>
    <script type="text/javascript" src="<%=basePath%>static/js/jquery-3.5.0.js">
    </script>
    <script src="<%=basePath%>static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=basePath%>static/js/xadmin.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span> 修改个人信息</strong></div>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <hr>
    <form action="" method="post" class="layui-form">
        ID： <input type="text" class="layui-input" name="doctorId" id="doctorId" size="50"/>
        <hr class="hr15">
        姓名： <input type="text" class="layui-input" name="name" id="name" size="50"/>
        <hr class="hr15">
        年龄： <input type="text" class="layui-input" name="age" id="age" size="50"/>
        <hr class="hr15">
        性别：<input type="text" class="layui-input" name="sex" id="sex" size="50"/>
        <hr class="hr15">
        入职日期： <input type="text" class="layui-input" name="entryDate" id="entryDate" size="50"/>
        <hr class="hr15">
        科室：<input type="text" class="layui-input" name="job" id="job" size="50"/>
        <hr class="hr15">
        用户登录名：<input type="text" class="layui-input" name="username" id="username" size="50"/>
        <hr class="hr15">

        <input value="提交" style="width:100%;" type="submit" onclick="doctorUpdate()">
        <hr class="hr20">
    </form>
</div>
</div>
<script>
    $(document).ready(function () {
        $("#doctorId").val(localStorage.getItem("doctorId"));
        $("#name").val(localStorage.getItem("name"));
        $("#age").val(localStorage.getItem("age"));
        $("#sex").val(localStorage.getItem("sex"));
        $("#entryDate").val(localStorage.getItem("entryDate"));
        $("#job").val(localStorage.getItem("job"));
        $("#username").val(localStorage.getItem("username"));
    })

    function doctorUpdate() {
        // ajax请求
        $.ajax({
            // 请求服务器的路径
           url: "../doctor/updateDoctor",
            // 服务器响应数据类型
            dataType: "json",
            // 提交方式
            Type: "post",
            // 发送给服务器的数据内容
            data: {
                "doctorId": $("#doctorId").val(),
                "name": $("#name").val(),
                "age": $("#age").val(),
                "sex": $("#sex").val(),
                "entryDate": $("#entryDate").val(),
                "job": $("#job").val(),
                "username": $("#username").val(),

            },//成功回调函数
            success:function (data) {
                alert(data.code);
                location.href = '../sys/doctorPage';
            },// 失败回调
            error: function () {
                alert("成功");
                location.href = '../sys/doctorPage';
            }
        })
    }
</script>
<%--修改个人信息--%>
</body>
</html>